<!DOCTYPE html>
<html lang='en'>

<head>
  <meta charset='UTF-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <title>Document</title>
  <script src='https://cdn.jsdelivr.net/npm/vue/dist/vue.js'></script>
</head>

<body>
  <template id="myCpn">
    <div>
      <slot :data="pLanguages">我是一个插槽</slot>
    </div>
  </template>

  <div id='app'>
    <h2>{{message}}</h2>
    <my-cpn>
      <template slot-scope="slot">
      <span>{{slot.data.join("-")}}</span>
     </template>
    </my-cpn>
  </div>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        message: 'hello world'
      },
      components: {
        myCpn: {
          template: '#myCpn',
          data() {
            return {
              pLanguages: ['JavaScript', 'Python', 'Swift', 'Go', 'C++']
            }
          }
        },

      }
    })
  </script>
</body>

</html>